package response

type Response struct {
	Code string      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func Err(code string, data interface{}) *Response {
	msg, _ := GetMsgByCode(code)
	return &Response{
		Code: code,
		Msg:  msg,
		Data: data,
	}
}

func Sucess(data interface{}) *Response {
	msg, _ := GetMsgByCode(SUCCESS)
	return &Response{
		Code: SUCCESS,
		Msg:  msg,
		Data: data,
	}
}
